import 'package:flutter/material.dart';

class Grid9 extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: '',
      home: new Scaffold(
        body: new Column(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          children: <Widget>[
            new Expanded(
                child: new GridRow(Colors.teal[200], Colors.teal[400], Colors.teal[800])
            ),
            new Expanded(
                child: new GridRow(Colors.yellow[200], Colors.yellow[400], Colors.yellow[800])
            ),
            new Expanded(
                child: new GridRow(Colors.red[200], Colors.red[400], Colors.red[800])
            )
          ],
        ),
      ),
    );
  }
}

class GridRow extends StatelessWidget{

  final Color c1;
  final Color c2;
  final Color c3;

  GridRow(this.c1, this.c2, this.c3);

  @override
  Widget build(BuildContext context) {
    return new Row(
      children: <Widget>[
        new Expanded(
          child: new Container(
            decoration: new BoxDecoration(
              color: c1,
            ),
            child: new Center(
              child: new Text('item1'),
            ),
          ),
        ),
        new Expanded(
          child: new Container(
            decoration: new BoxDecoration(
              color: c2,
            ),
            child: new Center(
              child: new Text('item2'),
            ),
          ),
        ),
        new Expanded(
          child: new Container(
            decoration: new BoxDecoration(
              color: c3,
            ),
            child: new Center(
              child: new Text('item3'),
            ),
          ),
        )
      ],
    );
  }

}
